package cn.healthlink.bean;
import org.springframework.beans.AbstractNestablePropertyAccessor;
import org.springframework.beans.DirectFieldAccessor;
import java.util.ArrayList;

/**
 * @author dengzhiyuan
 * @version 1.0
 * @time 2021/5/20 19:01
 */
public class BeanTest {

	public static void main(String[] args) {
		new BeanTest().propertyTest();
	}

	/**
	 *
	 */
	private void propertyTest(){
		//URL https://www.yuque.com/docs/share/4e7356aa-57fb-42fe-9e64-5411be995d14
		ProvinceBean provinceBean = new ProvinceBean();
		ArrayList<CompanyBean> list = new ArrayList<>();
		CompanyBean bean1= new CompanyBean("A1");
		CompanyBean bean2= new CompanyBean("A2");
		CompanyBean bean3= new CompanyBean("A3");
		list.add(bean1);
		list.add(bean2);
		list.add(bean3);
		provinceBean.setCompanyBeanList(list);
		AbstractNestablePropertyAccessor accessor = new DirectFieldAccessor(provinceBean);
		System.out.println(accessor.getPropertyValue("companyBeanList[1].name"));
	}

}
